package com.jy.api.payReq;

import com.jy.api.domain.Order;
import com.jy.api.domain.Reward;
import com.jy.api.domain.StorePay;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class SaoBeiQRCodeReq {
    private String pay_ver="110";

    private String pay_type="000";

    private String service_id="016";

    private String merchant_no;

    private String terminal_id;

    private String terminal_trace;

    private String terminal_time;

    private String total_fee;

    private String notify_url;

    private String key_sign;

    private String order_body="";

    private String attach="";


    public SaoBeiQRCodeReq(Order order, StorePay storePay) {
        this.merchant_no = storePay.getMchId();
        this.terminal_id = storePay.getTerminalId();
        this.terminal_trace = order.getId();
        this.total_fee = String.valueOf((int) Math.rint(order.getAmount() * 100));
    }

    public SaoBeiQRCodeReq(Reward reward, StorePay storePay) {
        this.merchant_no = storePay.getMchId();
        this.terminal_id = storePay.getTerminalId();
        this.terminal_trace = reward.getId();
        this.total_fee = String.valueOf((int) Math.rint(reward.getTotal() * 100));
    }
}
